package com.matrix.draft.helloworld.util;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;

public class MyUtil {

    public static String splitAndQuote(String str){
        Assert.notBlank(str,"要转换的字符串不能为空");
        String[] strArr = str.split(StrUtil.COMMA);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < strArr.length; i++) {
            sb.append("'").append(strArr[i]).append("'");
            if(i < strArr.length - 1){
                sb.append(StrUtil.COMMA);
            }
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        // System.out.println(splitAndQuote("1-1,1-1-0,1-1-8,1-1-1,1-1-2,1-1-4,1-1-5"));
        System.out.println(splitAndQuote(""));
    }

}
